<template>
  <div class="staffHomePhotography.vue">
    <div v-if="!$store.state.isbusNewsDitle">
      <div class="ditle_list_box">
        <div
          v-for="item in sheyingList"
          :key="item.id"
          class="ditle_item"
        >
          <img
            class="gra_img"
            :src="item.img"
            alt=""
          >
          <p
            class="ditle_title pointer"
            @click="handDitle(item)"
          >{{item.title}}</p>
        </div>
      </div>
      <div class="page_box">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5,10,15]"
          :page-size="pageBid3.limit"
          layout="total, prev, pager, next, jumper"
          :total="pageBid3.totalCount"
        >
        </el-pagination>
      </div>
    </div>
    <transition name="fade">
      <div
        v-if="$store.state.isbusNewsDitle"
        class="busDitle_dog"
      >
        <mydetails
          :sonList="ditleList"
          :dateils="dateils"
        ></mydetails>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  name: "staffHomePhotography.vue",
  props: {
    ditleList: {
      type: Array
    },
    sonid: {
      type: Number
    }
  },
  watch: {
    sonid(newid, oldid) {}
  },
  data() {
    return {
      pageBid3: {
        start: 1,
        limit: 6,
        totalCount: 0,
        tatalpage: 0
      },
      dateils: {},
      sheyingList: []
    };
  },
  mounted() {
    this.$api.getList({ sortId: this.sonid, page: 1, limit: 6 }).then(res => {
      this.sheyingList = res.data.data;
      console.log(res.data, "职工摄影");
      this.pageBid3.totalCount = res.data.count;
      this.sheyingList.forEach(item => {
        item.img = item.img.replace(/\\/g, "/");
        item.img = this.$store.state.baseUrl + item.img;
      });
    });
  },
  methods: {
    init(page) {
      this.$api
        .getList({ sortId: this.sonid, page: page, limit: 6 })
        .then(res => {
          this.sheyingList = res.data.data;
          this.sheyingList.forEach(item => {
            item.img = item.img.replace(/\\/g, "/");
            item.img = this.$store.state.baseUrl + item.img;
          });
        });
    },
    handDitle(item) {
      this.dateils = item;
      this.$store.commit("handBus", true);
    },
    handleSizeChange() {},
    handleCurrentChange(val) {
      console.log(val);
      this.init(val);
    }
  }
};
</script>

<style lang='scss' scoped>
.gra_img {
  width: 240px;
  height: 156px;
}
.ditle_list_box {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  text-align: center;
  color: #333333;
  font-size: 16px;

  .ditle_item {
    margin-bottom: 50px;
    .ditle_title {
      margin-top: 30px;
    }
  }
}
</style>
